Skip to content

feat: update test configuration to use specific PostGIS version and improve database readiness checks#586

Merged
jirhiker merged 1 commit intostagingfrom
jir-remove-pg_cron-dependency
Mar 5, 2026
Merged

feat: update test configuration to use specific PostGIS version and improve database readiness checks#586
jirhiker merged 1 commit intostagingfrom
jir-remove-pg_cron-dependency

Conversation

@jirhiker
Copy link
Copy Markdown
Member

@jirhiker jirhiker commented Mar 5, 2026

Summary

Revert .github/workflows/tests.yml from docker compose-managed DB startup back to native GitHub Actions services.postgis.

Why

docker compose was introduced when CI needed pg_cron support via a custom DB image build.
pg_cron has since been removed from test setup and is no longer a dependency, so the compose-based path is unnecessary overhead.

Changes

  1. Added services.postgis to both unit-tests and bdd-tests jobs using postgis/postgis:17-3.5.
  2. Removed Start database (PostGIS) steps that ran:
    • docker compose build db
    • docker compose up -d db
  3. Removed Stop database steps that ran:
    • docker compose down -v
  4. Kept existing DB readiness checks and DB/bootstrap SQL unchanged (CREATE DATABASE, CREATE EXTENSION IF NOT EXISTS postgis).

Impact

  • Simplifies CI workflow.
  • Avoids image build time in test jobs.
  • Aligns DB setup with current dependency set (PostGIS only).

Validation

  • Workflow file updated for both test jobs.
  • No application/runtime code changes.

Copilot AI review requested due to automatic review settings March 5, 2026 17:54
@jirhiker jirhiker merged commit 4312676 into staging Mar 5, 2026
6 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the GitHub Actions test workflow to run against a pinned PostGIS image and rely on service containers for database lifecycle management.

Changes:

  • Add a postgis/postgis:17-3.5 service container to unit and BDD test jobs
  • Remove docker compose steps previously used to start/stop the database
  • Add container healthcheck options for improved readiness signaling

You can also share your feedback on Copilot code review. Take the survey.

# image: postgis/postgis:latest
env:
POSTGRES_PASSWORD: postgres
POSTGRES_PORT: 5432
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

POSTGRES_PORT here is set as an environment variable inside the service container, but it does not configure Postgres’ listen port (Postgres listens on 5432 by default) and it is not exported to the job steps. If the tests/app need POSTGRES_PORT, set it under the job-level env: instead; otherwise, remove it to avoid implying it has an effect. (Same issue in the duplicated block in the bdd-tests job.)

Suggested change
POSTGRES_PORT: 5432

Copilot uses AI. Check for mistakes.
POSTGRES_PASSWORD: postgres
POSTGRES_PORT: 5432
options: >-
--health-cmd pg_isready
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The healthcheck pg_isready is more reliable when explicit about user/database (to avoid passing in scenarios where auth/db selection would fail later). Consider using an explicit command (e.g., include -U and -d) consistent with how the app connects.

Suggested change
--health-cmd pg_isready
--health-cmd pg_isready -U postgres -d postgres

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +48
services:
postgis:
image: postgis/postgis:17-3.5
# don't test against latest. be explicit in version being tested to avoid breaking changes
# image: postgis/postgis:latest
env:
POSTGRES_PASSWORD: postgres
POSTGRES_PORT: 5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PostGIS service configuration is duplicated in both unit-tests and bdd-tests. To reduce drift, consider factoring this into a reusable workflow (workflow_call) or using YAML anchors (if accepted in this repo’s workflow style) so the service definition is maintained in one place.

Copilot uses AI. Check for mistakes.
@jirhiker jirhiker deleted the jir-remove-pg_cron-dependency branch March 12, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants